package example.lesson03_3;

public class TestRef {
    public static void main(String[] args){
        Address address=new Address("zs","xyl");
        Person p1=new Person(30,"zhangsang");
        p1.age=20;
        Person p2=new Person();
        p2.age=100;
        System.out.println(p1);
    }
}
class Address{
    public String city;
    public String street;

    public Address(String city, String street) {
        this.city = city;
        this.street = street;
    }
}
class Person{
    public int age;
    public String name;
    public Address address;
    Person()
    {
        age=20;
    }
    Person(int age)
    {
        this.age=age;
    }
    Person(int age,String name)
    {
        this.age=age;
        this.name=name;

    }
    public String toString(){
        return "age:"+age+",name:"+name+",city:"+address.city+",street:"+address.street;
    }



}
